<%@ page language="java" import="java.util.*,com.hs.auth.model.*,com.hs.auth.*" pageEncoding="utf-8"%>
<%
//HsAccount accInfo = (HsAccount)request.getSession().getAttribute(AUTHConstant.USERINSESSION);
//HsUserinfo userinfo = accInfo==null?null:accInfo.getUserinfo();
//String accid = String.valueOf(accInfo.getId()); 

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<%@ include file="../../include.jsp"%>   
<script language="javascript" type="text/javascript" src="<%=path %>/thirtpart/My97DatePicker/WdatePicker.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath %>thirtpart/dhtmlx25/dhtmlxlayout.css"/>
<link rel="STYLESHEET" type="text/css" href="<%=basePath %>thirtpart/dhtmlx25/dhtmlxtree.css"/>
<link rel="stylesheet" type="text/css" href="<%=basePath %>thirtpart/dhtmlx25/skins/dhtmlxlayout_dhx_blue.css"/>
<script src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxcommon.js"></script>
<script src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxlayout.js"></script> 
<script src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxcontainer.js"></script>  
<script  src="<%=basePath %>thirtpart/dhtmlx25/dhtmlxtree.js"></script>    
<style>
		html, body {
			width: 100%;
			height: 100%;
			margin: 0px;
			padding: 0px; 
		}
	</style>
<script> 
<!--
		 
/**
简单检索
*/		
function generalSearch(display,condition){
	var win = document.getElementById('resultlist').contentWindow;
	var datarange = condition;
    var tags = getAllselectedId(); 
    if(null != tags && tags != ''){
    	var tarray = tags.split(','); 
        if(tarray != null){
        	if(tarray.length > 1000){
        		alert("最多只能选择1000个主题分类词,请删减!");
        		return;	
        	}
        }
    }
	//var divid = "txt_";
	//var onestr = "";
	//var win = document.getElementById('resultlist').contentWindow;
 	var basiccol = document.getElementById("basic_col").value;
	var basicvalue = document.getElementById("basic_colvalue").value;
	var basicspecial = document.getElementById("basic_special").value;
	var issyn = document.getElementById("issyn").value;
 	
	//alert(datarange);
	//if(isNull(basicvalue)){
	//	alert("检索条件不能为空!");
	//	document.getElementById("basic_colvalue").focus();
	//    return;
	//} 
	onestr = "?datarange="+datarange+"&issyn="+issyn+"&tags="+tags+"&basiccol="+basiccol +"&basicvalue="+basicvalue+"&basicspecial="+basicspecial+"&searchtype=basic_search";
 	document.getElementById("resultlist").src="<%=basePath %>search/dosearch.do"+onestr;
}	
//二次检索
function generalSecondSearch(condition){
	var win = document.getElementById('resultlist').contentWindow;
	var onesql = win.document.getElementById('onesql').value;
	var onekeyword = win.document.getElementById('onekeyword').value;
	//alert(onesql);
	var divid = "txt_";
	var onestr = "";
	var basiccol = document.getElementById("basic_col").value;
	var basicvalue = document.getElementById("basic_colvalue").value;
	var basicspecial = document.getElementById("basic_special").value;;
	if(isNull(basicvalue)){
		alert("检索条件不能为空!");
		document.getElementById("basic_colvalue").focus();
	    return;
	}
	onestr = "?basiccol="+basiccol +"&searchtype=basic_search&basicvalue="+basicvalue+"&basicspecial="+basicspecial+"&onekeyword="+onekeyword;
	alert(onestr);
	if(onesql !=null && onesql!=""){
		onestr = onestr + "&onesql=" + encodeURIComponent(onesql);
	}
	document.getElementById("resultlist").src="<%=basePath %>search/dosearch.do"+onestr;
	

}
 
function resetAll(){
 	var   obj   =   document.all.tags("input"); 
	for(i=0;i <obj.length;i++){ 
    if(obj[i].type== "text"){ 
            obj[i].value   =   ""; 
    } 
}
 
 }
 /**
 	控制各个检索模块DIV的显示
 */
 function searchViewDisplay(divid){
 	 var div1 = document.getElementById(divid); 
 	 var iframeobj = document.getElementById("resultlist");
     if('basic_search' == divid){
     	 if(div1.style != null){
     		 div1.style.display="";
      		 if(null != iframeobj)
     		 	iframeobj.src = '<%=basePath%>/search/dosearch.do?searchtype=basic_search';
     	}else{
	     	hidediv('advsearch');
	     	hidediv('advmod');
	     	hidediv('adveng');
	     	hidediv('advbook');
     	}
     } else if('advsearch' == divid){
     	 if(div1.style != null){
     		 div1.style.display="";
     		 if(null != iframeobj)
     		 	iframeobj.src = '<%=basePath%>/search/dosearch.do?searchtype=advsearch';
     	}else{
	     	hidediv('basic_search');
	     	hidediv('advmod');
	     	hidediv('adveng');
	     	hidediv('advbook');
     	}
     } else if('advmod' == divid){
     	 if(div1.style != null){
     		 div1.style.display="";
     		 if(null != iframeobj)
     		 	iframeobj.src = '<%=basePath%>/search/dosearch.do?searchtype=advmod';
	     }else{
	     	hidediv('basic_search');
	     	hidediv('advsearch');
	     	hidediv('adveng');
	     	hidediv('advbook');
	     }
     } else if('adveng' == divid){
     	if(div1.style != null){
     		 div1.style.display="";
     		 if(null != iframeobj)
     		 	iframeobj.src = '<%=basePath%>/search/dosearch.do?searchtype=adveng';
     	}else{
	     	hidediv('basic_search');
	     	hidediv('advmod');
	     	hidediv('advsearch');
	     	hidediv('advbook');
     	}
     } else if('advbook' == divid){
     	if(div1.style != null){
     		 div1.style.display="";
     		 if(null != iframeobj)
     		 	iframeobj.src = '<%=basePath%>/search/dosearch.do?searchtype=advbook';
     	}else{
     	hidediv('basic_search');
     	hidediv('advmod');
     	hidediv('advsearch');
     	hidediv('adveng');
     	}
     } 
 }
 /**
 	隐藏DIV显示
 */
 function hidediv(hidiv){
 	 var obj = document.getElementById(hidiv);
 	  if(div1.style != null)
     		 div1.style.display="none";
 }
 /**
 	获得对象
 */
 
 function ge(a){return document.getElementById(a)}
 /**
 	增加行
 */
 function AddRowEx(divid,divindex,divcount){
 	try{
		if(ge(divindex).value==ge(divcount).value){
			return
		}
		var curID=parseInt($("#"+divindex).val());
		var copyID=curID+1;
		var curTrID=divid+"_"+curID.toString();
		var copyTrID=divid+"_"+copyID.toString();
		//alert(curTrID + "," + copyTrID);
		var copyHtml="";
		if($("#"+copyTrID).html()!=null){
			$("#"+copyTrID).show()
		}else{
			var cloneObj=$("#"+curTrID).clone();
			if(curID==1){
				if(cloneObj.find("td:first")!=null){
					cloneObj.find("td:first").remove()
				}
				if(cloneObj.find("span:first")!=null){
					cloneObj.find("span:first").remove()
				}
				var logicalTd=$("#hidden_logical_"+divid).html();
				if(logicalTd!=""){
					var reg=/{key}/g;
					logicalTd=logicalTd.replace(reg,copyTrID);
					cloneObj=cloneObj.prepend(logicalTd)
				}
			}
			copyHtml=$("<div></div>").append(cloneObj).html();
			var reg1=eval("/"+curTrID+"/g");
			copyHtml=copyHtml.replace(reg1,divid+"_"+copyID.toString());
			//alert(copyHtml);
			if(copyHtml!=""){
				$("#"+curTrID).after(copyHtml)
			}
		}
		var objvalue=ge(copyTrID+"_value1");
		if(objvalue!=null){
			objvalue.value=""
		}
		objvalue=ge(copyTrID+"_value2");
		if(objvalue!=null){
			objvalue.value=""
		}
		ge(divindex).value=copyID.toString();
		var obj=ge(copyTrID+"_sel");
		if(!obj){
			obj=ge(copyTrID+"_sel1")
		}
		if(obj){
			obj.options[copyID-1].selected=true;
			obj.onchange()
		}
	}catch(e){
	}
	 
 }

 function DeleteRow(h,c,b){
	try{
		if(ge(c).value=="1"){
			return
		}else{
			var g=parseInt(ge(c).value);
			var f=h+"_"+g;var a=ge(f+"_value1");
			if(a!=null){
				a.value=""
			}
			a=ge(f+"_value2");
			if(a!=null){
				a.value=""
			}
			ge(f).style.display="none";
			g--;
			ge(c).value=g
		}
	}catch(d){
	return
	}
}
function resetAll(){
 	var   obj   =   document.all.tags("input"); 
	for(i=0;i <obj.length;i++){ 
	    if(obj[i].type== "text"){ 
	            obj[i].value   =   ""; 
	    } 
	}
 
}


/**
高级检索
*/
function advSearch(datarange){
    
	var divid = "txt_";
	var onestr = "?searchtype=advsearch&";
	for(var i=1; i<=32; i++){
		var divcur = divid + i + "_value";
		var curobj = document.getElementById(divcur);
		var curvalueStr = divid+i+"_value";
		var curlogicStr = divid+i+"_logical";
		var curselStr = divid+i+"_sel";
		var curspecialStr = divid+i+"_special";
		
		if(curobj != undefined ){
			if(curobj.value != "")
			{
				var curvalue = curobj.value;
				if(i !=1){
					var curlogic = document.getElementById(curlogicStr).value;
				}else{
					var curlogic = 0 ;
				}
				var cursel = document.getElementById(curselStr).value;
				var curspecial = document.getElementById(curspecialStr).value;
				if(onestr.indexOf("&")!=-1){
					onestr = onestr + "&";
				}
				onestr = onestr + curvalueStr+"="+curvalue+"&"+curlogicStr+"="+curlogic+"&"+curselStr+"="+cursel+"&"+curspecialStr+"="+curspecial;
			}
		}
		
	}  
	var tags = getAllselectedId();
	if(null != tags && tags != ''){
    	var tarray = tags.split(','); 
        if(tarray != null){
        	if(tarray.length > 1000){
        		alert("最多只能选择1000个主题分类词,请删减!");
        		return;	
        	}
        }
    }
    onestr +="&datarange="+datarange+"&tags="+tags;
   
	document.getElementById("resultlist").src="<%=basePath %>search/dosearch.do"+onestr;
}
/**
高级现代中文期刊检索
*/
function advModSearch(){
	var divid = "mod_";
	var onestr = "?searchtype=advmod&";
	for(var i=1; i<=14; i++){
		var divcur = divid + i + "_value";
		var curobj = document.getElementById(divcur);
		var curvalueStr = divid+i+"_value";
		var curlogicStr = divid+i+"_logical";
		var curselStr = divid+i+"_sel";
		var curspecialStr = divid+i+"_special";
		
		if(curobj != undefined ){
			if(curobj.value != "")
			{
				var curvalue = curobj.value;
				if(i !=1){
					var curlogic = document.getElementById(curlogicStr).value;
				}else{
					var curlogic = 0 ;
				}
				var cursel = document.getElementById(curselStr).value;
				var curspecial = document.getElementById(curspecialStr).value;
				if(onestr.indexOf("&")!=-1){
					onestr = onestr + "&";
				}
				onestr = onestr + curvalueStr+"="+curvalue+"&"+curlogicStr+"="+curlogic+"&"+curselStr+"="+cursel+"&"+curspecialStr+"="+curspecial;
			}
		}
		
	}  
	var tags = getAllselectedId();
	if(null != tags && tags != ''){
    	var tarray = tags.split(','); 
        if(tarray != null){
        	if(tarray.length > 1000){
        		alert("最多只能选择1000个主题分类词,请删减!");
        		return;	
        	}
        }
    }
    
    var starty = document.getElementById('startyearmod').value;
    var endy = document.getElementById('endyearmod').value;
    onestr+="&startyearmod="+starty+"&endyearmod="+endy+"&tags="+tags;
    //alert(onestr);
	document.getElementById("resultlist").src="<%=basePath %>search/dosearch.do"+onestr;
}
/**
高级英文期刊检索
*/
function advEngSearch(){
	var divid = "eng_";
	var onestr = "?searchtype=adveng&";
	for(var i=1; i<=10; i++){
		var divcur = divid + i + "_value";
		var curobj = document.getElementById(divcur);
		var curvalueStr = divid+i+"_value";
		var curlogicStr = divid+i+"_logical";
		var curselStr = divid+i+"_sel";
		var curspecialStr = divid+i+"_special";
		
		if(curobj != undefined ){
			if(curobj.value != "")
			{
				var curvalue = curobj.value;
				if(i !=1){
					var curlogic = document.getElementById(curlogicStr).value;
				}else{
					var curlogic = 0 ;
				}
				var cursel = document.getElementById(curselStr).value;
				var curspecial = document.getElementById(curspecialStr).value;
				if(onestr.indexOf("&")!=-1){
					onestr = onestr + "&";
				}
				onestr = onestr + curvalueStr+"="+curvalue+"&"+curlogicStr+"="+curlogic+"&"+curselStr+"="+cursel+"&"+curspecialStr+"="+curspecial;
			}
		}
		
	}  
	var tags = getAllselectedId();
	if(null != tags && tags != ''){
    	var tarray = tags.split(','); 
        if(tarray != null){
        	if(tarray.length > 1000){
        		alert("最多只能选择1000个主题分类词,请删减!");
        		return;	
        	}
        }
    }
    var starty = document.getElementById('startyeareng').value;
    var endy = document.getElementById('endyeareng').value;
    onestr+="&startyeareng="+starty+"&endyeareng="+endy+"&tags="+tags;
   // alert(onestr);
	document.getElementById("resultlist").src="<%=basePath %>search/dosearch.do"+onestr;
}
/**
高级古籍检索
*/
function advBookSearch(){
	var divid = "book_";
	var onestr = "?searchtype=advbook&";
	for(var i=1; i<=6; i++){
		var divcur = divid + i + "_value";
		var curobj = document.getElementById(divcur);
		var curvalueStr = divid+i+"_value";
		var curlogicStr = divid+i+"_logical";
		var curselStr = divid+i+"_sel";
		var curspecialStr = divid+i+"_special";
		
		if(curobj != undefined ){
			if(curobj.value != "")
			{
				var curvalue = curobj.value;
				if(i !=1){
					var curlogic = document.getElementById(curlogicStr).value;
				}else{
					var curlogic = 0 ;
				}
				var cursel = document.getElementById(curselStr).value;
				var curspecial = document.getElementById(curspecialStr).value;
				if(onestr.indexOf("&")!=-1){
					onestr = onestr + "&";
				}
				onestr = onestr + curvalueStr+"="+curvalue+"&"+curlogicStr+"="+curlogic+"&"+curselStr+"="+cursel+"&"+curspecialStr+"="+curspecial;
			}
		}
		
	}  
	var tags = getAllselectedId();
	if(null != tags && tags != ''){
    	var tarray = tags.split(','); 
        if(tarray != null){
        	if(tarray.length > 1000){
        		alert("最多只能选择1000个主题分类词,请删减!");
        		return;	
        	}
        }
    }
    //var tcmname = document.getElementById('tcmname').value;
    //var tcmname_logic = document.getElementById('tcmname_logic').value;
    //var tcmsyn = document.getElementById('synname');
   // var synflag = '';
   // if(tcmsyn.checked)
   // 	synflag = tcmsyn.value;
   // onestr +='&tcmname='+tcmname+'&tcmname_logic='+tcmname_logic+'&tcmsyn='+synflag+"&tags="+tags;
    //alert(onestr);
	document.getElementById("resultlist").src="<%=basePath %>search/dosearch.do"+onestr;
}
		//-->
function issynCheck(){
   var colselected = document.getElementById("basic_col").value;
   if('DISNAME' == colselected){
   		var obj = document.getElementById("issyn");
   		obj.disabled = false; 
   		obj.checked = true;
   }else{
   		var obj = document.getElementById("issyn");
   		obj.disabled = true; 
   		obj.checked = false;
   }
}	
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    	<td width="300px">
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
    	<td width="98%" align=left >
    	  <input   type="button" class="butto" style="margin-left:10px" onclick="resetAllTree();" value=" 清 除 "/>
    	  <font color=red>如需联合检索，请先勾选主题分类词。 可提供中英文、古文共通检索</font> 
        </td> 
       </tr> 
		    <tr>
		    	<td width="100%">
		        	<div id="treeboxbox_tree" style="width:95%;margin-left:10px;overflow:auto;border:1px solid #bdc0c3;"></div>   
		        </td> 
		    </tr> 
		</table>   
        </td>
        <td> 
        <div class="tab">
            	<span><a href="javaScript:generalSearch('','');" style="TEXT-DECORATION:none;">全库基本检索</a></span>
                <span><a href="javaScript:advSearch('');" style="TEXT-DECORATION:none;">全库高级检索</a></span>
                <span><a href="javaScript:advModSearch();" style="TEXT-DECORATION:none;">中文期刊检索</a></span>
                <span><a href="javaScript:advEngSearch();" style="TEXT-DECORATION:none;">英文期刊检索</a></span>
                <span><a href="javaScript:advBookSearch();" style="TEXT-DECORATION:none;">古籍检索</a></span>
        </div> 
        <div class="sear" id="basic_search" style="display:block">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">  
             <tr>
			     <td nowrap="true" width="10%" align=center>
			    		检索入口
		         </td> 
			     <td width="15%" align=center>
				     <select  name='basic_col' id='basic_col' style="width:99%" onchange="issynCheck();"> 
				            <option value="DISNAME">疾病名称</option>
				            <option value="ALL">任意字段</option>
			                <option value="TITLE">标题</option>
			               
			                <option value="KEYWORD">关键词</option>
			                <option value="SUBJECTWORD">主题词</option>
			                <option value="ORIGINALTEXT">摘要/古籍原文</option>
			                <option value="AUTHOR">作者</option> 
			                <!--option value="AUTHOR">英文作者</option-->
			                <option value="PERIODICALNAME">刊名</option>  
			                <!--option value="PERIODICALNAME">英文刊名</option-->  
							
							<option value="YEARSTR">年份</option>
							
							 
							<!-- option value="TCMNAME">中医病名</option>
							<option value="VOLUMESECTION">卷册章节</option>
							<option value="AUTHORUNIT">作者单位</option>
							<option value="AUTHORADDRESS">作者通讯地址</option>
 							<option value="LANGUAGE">语种</option>
							<option value="DOCUMENTTYPE">文献类型</option>
							<option value="CLASSNO">分类号</option>
							<option value="FUNDSTR">资助情况</option-->
							
							<option value="PERIOD">期</option> 
							<option value="FUNDNAME">基金</option>
							<option value="FUNDTYPE">资助类别</option>
							<option value="BOOKNAME">书籍名称</option>
							<option value="BOOKCD">朝代</option>
							<option value="TCMNAME">中医病名</option>
							
							
							
							<!-- option value="COMFROM">文献来源</option>
							<option value="AREASTR">国家\省市</option>
							<option value="CWNUM">参文数</option>
							<option value="PUBLISHAREA">出版地</option>
							<option value="IMPRESSWORD">特征词</option>
							<option value="USERSUBJECT">人名主题</option--> 
			          </select>
			       </td>
			      <td width="35%" >
			     	<input name="basic_colvalue" id="basic_colvalue" type="text" value="" style="width:98%"  />
			      </td>
			      <td width="10%" align=center>
				     <select id="basic_special" name="basic_special" style="width:97%">
					     <option value=0>精确</option>
					     <option value=1 selected>模糊</option>
				     </select>
			      </td> 
			      <td width="10%" align=center>
				     <input type="checkbox" value="1" id="issyn"   name="issyn"  />同义词检索
			      </td> 
			       
			      <!-- td rowspan=2  align=center nowrap>
                    <input   type="button" class="butto" onclick="generalSearch('','');" value=" 检 索 "/>
                    <input   type="button" class="butto" onclick="resetAll();" value=" 清 除 "/> 
                    <input   type="button" class="butto" onclick="generalSecondSearch('');" value="二次检索"/>
                 </td-->
			      <td   align=center nowrap>
                    <input   type="button" class="butto" onclick="generalSearch('','');" value=" 检 索 "/>
                    <input   type="button" class="butto" onclick="resetAll();" value=" 清 除 "/> 
                    <input   type="button" class="butto" onclick="generalSecondSearch('');" value="二次检索"/>
                 </td>
              </tr>
         </table> 
        </div>  
        <div class="sear" id="advsearch" style="display:none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">  
             <input id="txt_i" value="1" type="hidden" name="txt_i"></input>
             <input id="txt_c" value="31" type="hidden" name="txt_c"></input>
             <tr id="hidden_logical_txt" style="display:none">
                <td nowrap="true" style="width:10%;" align="right" >
                    <select id="{key}_logical" name="{key}_logical">
                        <option value="0" selected="">并且</option>
                        <option value="1">或者</option>
                    </select> 
                </td>
             </tr> 
             <tr id="txt_1">
	             <td nowrap  width="10%" align=center>
		    			<input onclick="AddRowEx('txt','txt_i','txt_c');" type="button" value="增加" class="butto add"/>
		    			<input onclick="DeleteRow('txt','txt_i','txt_c');" type="button" value="删除" class="butto delete"/>
	             </td> 
	             <td width="15%">
		     		<select id='txt_1_sel' name='txt_1_sel' style="width:100%">
	                        <!-- option value="TITLE">中文标题</option>
							<option value="TITLEN">英文标题</option>
							<option value="BOOKNAME">书籍名称</option> 
							<option value="VOLUMESECTION">卷册章节</option>
							<option value="ORIGINALTEXT">原文文本</option>
							<option value="PERIODICALNAME">期刊名称</option> 
							<option value="AUTHOR">作者</option>
							<option value="AUTHOREN">英文作者</option>
							<option value="AUTHORUNIT">作者单位</option>
							<option value="AUTHORADDRESS">作者通讯地址</option>
							<option value="KEYWORD">关键字</option> 
							<option value="SUBJECTWORD">中文主题词</option> 
							<option value="ABSTRACT">摘要</option> 
							<option value="LANGUAGE">语种</option>
							<option value="DOCUMENTTYPE">文献类型</option>
							<option value="CLASSNO">分类号</option>
							<option value="FUNDSTR">资助情况</option>
							<option value="YEARSTR">年份</option>
							<option value="PERIOD">期</option> 
							<option value="FUNDTYPE">资助类别</option>
							<option value="COMFROM">文献来源</option>
							<option value="AREASTR">国家\省市</option>
							<option value="CWNUM">参文数</option>
							<option value="PUBLISHAREA">出版地</option>
							<option value="IMPRESSWORD">特征词</option>
							<option value="USERSUBJECT">人名主题</option> 
			             	<option value='BOOKCD'>朝代</option--20130219 注释-->
			             	<option value="TITLE">            中文标题        </option>
<option value="PERIODICALNAME">    刊名            </option>
<option value="AUTHOR">            作者            </option>
<option value="AUTHORUNIT">        第一作者单位    </option>
<option value="AUTHORADDRESS">     第一作者通讯地址</option>
<option value="KEYWORD">           中文关键词      </option>
<option value="SUBJECTWORD">       中文主题词      </option>
<option value="ABSTRACT">          中文摘要        </option>
<option value="YEARSTR">           年份            </option>
<option value="VOLUME">            卷              </option>
<option value="PERIOD">            期              </option>
<option value="PAGENO">            页码            </option>
<option value="LANGUAGE">          语种            </option>
<option value="DOCUMENTTYPE">      文献类型        </option>
<option value="CLASSNO">           分类号          </option>
<option value="FUNDSTR">           资助情况        </option>
<option value="FUNDTYPE">          资助类别        </option>
<option value="FUNDNAME">          基金            </option>
<option value="TITLEN">            英文标题        </option>
<option value="AUTHOREN">          英文作者        </option>
<option value="AUTHORADDRESS">     英文作者地址    </option>
<option value="PERIODICALNAMEENG"> 英文刊名        </option>
<option value="KEYWORD">           英文关键词      </option>
<option value="SUBJECTWORD">       英文主题词      </option>
<option value="ABSTRACT">          英文摘要        </option>
<option value="BOOKNAME">          书籍名称        </option>
<option value="AUTHOR">            著者            </option>
<option value="BOOKCD">            朝代            </option>
<option value="TCMNAME">           中医病名        </option>
<option value="VOLUMESECTION">     卷册章节        </option>
<option value="BOOKVERSION">       版本            </option>
<option value="ORIGINALTEXT">      古籍原文      </option>
			             	
			          </select>
	             </td>
	             <td width="60%" >
	     				<input name="txt_1_value" id="txt_1_value" type="text" value="" style="width:99%" class="sear_input"/>
	     		 </td>
	     		 <td width="15%">
				     <select id="txt_1_special" name="txt_1_special" style="width:100%">
					    <option value=0>精确</option>
					     <option value=1 selected>模糊</option>
				     </select>
	     		 </td>
	     	 </tr> 
	     	 <tr>
                 
                <td colspan=4 align=center>
                	<input name="" type="button" class="butto" onclick="advSearch('');" value=" 检 索 "/>&nbsp;
                    <input name="" type="button" class="butto" onclick="resetAll();" value=" 清 除 "/> 
                </td>
               </tr>
             
         </table> 
        </div> 
        <div class="sear" id="advmod" style="display:none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">  
             <input id="mod_i" value="1" type="hidden" name="mod_i"></input>
             <input id="mod_c" value="22" type="hidden" name="mod_c"></input>
             <tr id="hidden_logical_mod" style="display:none">
                <td nowrap="true" style="width:10%;" align="right" >
                    <select id="{key}_logical" name="{key}_logical">
                        <option value="0" selected="">并且</option>
                        <option value="1">或者</option>
                    </select> 
                </td>
             </tr> 
             <tr id="mod_1">
	             <td nowrap  width="10%" align=center>
		    			<input onclick="AddRowEx('mod','mod_i','mod_c');"   type="button" value="增加" class="butto add"/>
		    			<input onclick="DeleteRow('mod','mod_i','mod_c');"   type="button" value="删除" class="butto delete"/>
	             </td> 
	             <td width="15%">
		     		<select id='mod_1_sel' name='mod_1_sel' style="width:100%">  
		     		        <option value="TITLE">中文标题</option>
		     		        <option value="PERIODICALNAME">刊名</option>  
							<option value="AUTHOR">作者</option> 
							<option value="AUTHORUNIT">第一作者单位</option>
							<option value="AUTHORADDRESS">第一作者通讯地址</option>
							<option value="KEYWORD">中文关键字</option> 
							<option value="SUBJECTWORD">中文主题词</option>
							<option value="ABSTRACT">中文摘要</option>
							<option value="YEARSTR">年份</option>
							<option value="VOLUME">卷</option>
							<option value="PERIOD">期</option>
							<option value="FUNDSTR">资助情况</option> 
							<option value="FUNDTYPE">资助类别</option>
							<option value="FUNDNAME">基金</option>
			          </select>
	             </td>
	             <td width="60%" >
	     				<input name="mod_1_value" id="mod_1_value" type="text" value="" style="width:99%" class="sear_input"/>
	     		 </td>
	     		 <td width="15%">
				     <select id="mod_1_special" name="mod_1_special" style="width:100%">
					     <option value=0>精确</option>
					     <option value=1 selected>模糊</option>
				     </select>
	     		 </td>
	     	 </tr> 
              <tr>
                <td align=center>出版时间</td>
                <td><input type="text" class="Wdate" id="startyearmod" value="" style="width:70%;vertical-align:middle" name="startyearmod"  onFocus="WdatePicker({el:'startyearmod',dateFmt:'yyyy'})"  /></td>
                <td>-<input type="text" class="Wdate" id="endyearmod" value="" style="width:20%;vertical-align:middle" name="endyearmod"  onFocus="WdatePicker({el:'endyearmod',dateFmt:'yyyy'})"  />
                  
                </td>
                <td>
                	<input name="" type="button" class="butto" onclick="advModSearch('','');" value=" 检 索 "/>&nbsp;
                    <input name="" type="button" class="butto" onclick="resetAll();" value=" 清 除 "/> 
                </td>
               </tr>
         </table> 
        </div> 
        <div class="sear" id="adveng" style="display:none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">  
             <input id="eng_i" value="1" type="hidden" name="eng_i"></input>
             <input id="eng_c" value="18" type="hidden" name="eng_c"></input>
             <tr id="hidden_logical_eng" style="display:none">
                <td nowrap="true" style="width:10%;" align="right" >
                    <select id="{key}_logical" name="{key}_logical">
                        <option value="0" selected="">并且</option>
                        <option value="1">或者</option>
                    </select> 
                </td>
             </tr> 
             <tr id="eng_1">
	             <td nowrap  width="10%" align=center>
		    			<input onclick="AddRowEx('eng','eng_i','eng_c');" type="button" value="增加" class="butto add"/>
		    			<input onclick="DeleteRow('eng','eng_i','eng_c');" type="button" value="删除" class="butto delete"/>
	             </td>  
	             <td width="15%">
		     		<select id='eng_1_sel' name='eng_1_sel' style="width:100%"> 
							<option value="TITLE">英文标题</option>
							<option value="AUTHOR">英文作者</option> 
							<option value="AUTHORADDRESS">英文作者地址</option>
							<option value="PERIODICALNAME">英文刊名</option>  
							<option value="KEYWORD">英文关键字</option> 
							<option value="SUBJECTWORD">英文主题词</option> 
							<option value="ABSTRACT">英文摘要</option>  
							<option value="YEARSTR">年份</option>
							<option value="VOLUME">卷</option> 
							<option value="PERIOD">期</option>
			          </select>
	             </td>
	             <td width="60%" >
	     				<input name="eng_1_value" id="eng_1_value" type="text" value="" style="width:99%" class="sear_input"/>
	     		 </td>
	     		 <td width="15%">
				     <select id="eng_1_special" name="eng_1_special" style="width:100%">
					     <option value=0>精确</option>
					     <option value=1 selected>模糊</option>
				     </select>
	     		 </td>
	     	 </tr> 
              <tr>
                <td align=center>出版时间</td>
                <td><input type="text" class="Wdate" id="startyeareng" value="" style="width:70%;vertical-align:middle" name="startyeareng"  onFocus="WdatePicker({el:'startyeareng',dateFmt:'yyyy'})"  /></td>
                <td>-<input type="text" class="Wdate" id="endyeareng" value="" style="width:20%;vertical-align:middle" name="endyeareng"  onFocus="WdatePicker({el:'endyeareng',dateFmt:'yyyy'})"  />
                
                </td>
                <td>
                	<input name="" type="button" class="butto" onclick="advEngSearch('','');" value=" 检 索 "/>&nbsp;
                    <input name="" type="button" class="butto" onclick="resetAll();" value=" 清 除 "/> 
                </td>
               </tr>
         </table> 
        </div> 
        <div class="sear" id="advbook" style="display:none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">  
             <input id="book_i" value="1" type="hidden" name="book_i"></input>
             <input id="book_c" value="5" type="hidden" name="book_c"></input>
             <tr id="hidden_logical_book" style="display:none">
                <td nowrap="true" style="width:10%;" align="right" >
                    <select id="{key}_logical" name="{key}_logical">
                        <option value="0" selected="">并且</option>
                        <option value="1">或者</option>
                    </select> 
                  </td>
             </tr> 
             <tr id="book_1">
	             <td nowrap  width="10%" align=center>
		    			<input onclick="AddRowEx('book','book_i','book_c');" type="button" value="增加" class="butto add"/>
		    			<input onclick="DeleteRow('book','book_i','book_c');" type="button" value="删除" class="butto delete"/>
	              </td> 
	             <td width="15%"> 
		     		<select id='book_1_sel' name='book_1_sel' style="width:100%"> 
	                   		<option value="BOOKNAME">书籍名称</option> 
	                   		<option value="AUTHOR">作者</option>
	                   		<option value='BOOKCD'>朝代</option>
	                   		<option value="TCMNAME">中医病名</option> 
							<option value="VOLUMESECTION">卷册章节</option>
							<option value="BOOKVERSION">版本</option>
							<option value="ORIGINALTEXT">古籍原文</option>  
			          </select>
	              </td>
	             <td width="60%" >
	     				<input name="book_1_value" id="book_1_value" type="text" value="" style="width:99%" class="sear_input"/>
	     		  </td>
	     		 <td width="15%">
				     <select id="book_1_special" name="book_1_special" style="width:100%">
					     <option value=0>精确</option>
					     <option value=1 selected>模糊</option>
				     </select>
	     		 </td>
	     	 </tr>  
               <tr> 
                <td colspan=4 align=center><input name="" type="button" class="butto" onclick="advBookSearch('','');" value=" 检 索 "/>&nbsp;
                    <input name="" type="button" class="butto" onclick="resetAll();" value=" 清 除 "/> 
                 </td>
               </tr>
         </table>  
        </div>  
        <iframe src="<%=basePath%>search/dosearch.do" width="100%" frameborder="0" height="100%" id="resultlist" name="resultlist"  ></iframe>
        </td> 
        
    </tr>
   
</table>
</body>
</html> 
<script language=javascript>
var MS = "IE";
if(navigator.userAgent.indexOf("Firefox") > 0) {
    MS = "FF";
}
if (document.getElementById("resultlist")!=null) {   
     if (document.documentElement.clientHeight > 200) {
        document.getElementById("resultlist").style.height = document.documentElement.clientHeight - 100 + "px";
     }
     
}
if (document.getElementById("treeone")!=null) {   
     if (document.documentElement.clientHeight > 200) {
        document.getElementById("treeone").style.height = document.documentElement.clientHeight - 25 + "px";
     }
}

</script>

<script> 
var tagtype = "";
//获得所有被选中的选项
function getAllselectedId() {  
    var selectedList = tree.getAllChecked();  
    return selectedList;
    
}
//清除所有被选中的选项
function clearAllSelectedItem(){
     if(tagtype != "")
	   tree.refreshItem(tagtype);
	   tagtype = "";
    //tree.clearSelection();
}
function submitSearch(){ 
  // window.parent.searchresult.submitSearchForm();
}
function tonclick(itemId) {
    if(itemId == 10000 || itemId==1 || itemId == 2 || itemId == 3 || itemId ==4)
       return;
       
    var checkState = tree.isItemChecked(itemId); 
    if('0' == checkState){
	    //判断是否选择了其他分类的选项
	    var userData = tree.getUserData(itemId,"tagtype");
	    if("" == tagtype){
	    	tagtype = userData;
	    }else{
	    	if(tagtype != userData){
	    	   alert("检索主题分类共分为四个主题：病名、方剂、证候、中药，同时只能选择一个主题分类！");
	    	   tree.clearSelection(itemId);
	    	   return;
	    	}
	    }
    	tree.setSubChecked(itemId,1) ;
    }
    if('1' == checkState){
    	tree.setSubChecked(itemId,0) ;
    	var allselects = getAllselectedId();
    	if("" == allselects){
    	     tagtype = "";
    	}
    	
    }
    //提交检索
    submitSearch();
};
function tondblclick(itemId) {
     
};
function toncheck(itemId) {
    if(itemId == 10000)
       return;
    var checkState = tree.isItemChecked(itemId); 
    tree.setSubChecked(itemId,checkState) ;
   //var nodelist = tree.getAllSubItems(itemId);
   //for(var i=0;i<nodelist.length;i++){
   	//	var subnode = tree.getAllSubItems(itemId);
   		
  // }
  	var allselects = getAllselectedId();
    	if("" == allselects){
    	     tagtype = "";
    	}
    //提交检索
    submitSearch();
};
function tonopen(id, mode) {
    return confirm("Do you want to " + (mode > 0 ? "close": "open") + " node " + tree.getItemText(id) + "?");
}; 

function doOnLoad() {
   //tree
tree = new dhtmlXTreeObject("treeboxbox_tree", "100%", "97%", 0);
tree.enableTreeLines(true);
tree.enableCheckBoxes(true);
//tree.setSkin('dhx_skyblue');
tree.setImagePath("<%=basePath %>thirtpart/dhtmlx25/imgs/csh_winstyle/");
tree.enableDragAndDrop(0);
tree.enableTreeLines(true);
//tree.setImageArrays("plus", "", "", "", "plus.gif");
//tree.setImageArrays("minus", "", "", "", "minus.gif");
//tree.setStdImages("book.gif", "books_open.gif", "books_close.gif");
//tree.setImageArrays("plus", "", "", "", "", "plus.gif");
//tree.setImageArrays("minus", "", "", "", "", "minus.gif");
//tree.setStdImages("book.gif", "folderOpen.gif", "folderClosed.gif");
 
//tree.setOnOpenHandler(tonopen);
//tree.attachEvent("onOpenEnd", function(nodeId, event) {
//    doLog("An id of open item is " + nodeId);
//});
tree.setOnClickHandler(tonclick);
tree.setOnCheckHandler(toncheck);
tree.attachEvent("onBeforeCheck", function(id,state){
	var userData = tree.getUserData(id,"tagtype"); 
    if("0" == state ){
	    if("" == tagtype){
	    	tagtype = userData;
	    	return true;
	    }else{
	    	if(tagtype != userData){
	    	   alert("检索主题分类共分为四个主题：病名、方剂、证候、中药，同时只能选择一个主题分类！"); 
	    	   return false;
	    	}else{
	    	   return true;
	    	}
	    } 
    } else{
    	return true;
    }
});

//tree.setOnDblClickHandler(tondblclick);

tree.preventIECaching(true);
//tree.enableSmartXMLParsing(true);//false to disable 
tree.enableDistributedParsing(true,20,50);
//tree.enableSmartXMLParsing(true); 

tree.setXMLAutoLoading("<%=basePath %>search/loadnode.do");
// tree.loadXML("<%=basePath %>search/subjecttree.do");
tree.loadXML("<%=basePath %>search/maintree.do");	
	
}
doOnLoad(); 
var divH = window.screen.availHeight*0.73;
//document.getElementById("treeboxbox_tree").style.height = divH; 
//alert(document.getElementById("treeboxbox_tree").style.height);
//alert(window.screen.availHeight);
//tree.showItemCheckbox(1, false);
 function resetAllTree(){
 	clearAllSelectedItem();
 }
//AddRowEx('txt','txt_i','txt_c');
//  AddRowEx('txt','txt_i','txt_c'); 
 // AddRowEx('mod','mod_i','mod_c');
 // AddRowEx('mod','mod_i','mod_c');
 // AddRowEx('eng','eng_i','eng_c');
 // AddRowEx('eng','eng_i','eng_c');
 // AddRowEx('book','book_i','book_c');
 // AddRowEx('book','book_i','book_c');
	</script>